/**
 * Copyright 2009-2010 - YangJiandong(chunquedong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 你可以自由复制、传播本项目的下载包文件，但必须保持其完整性。
 * 我们不用对使用中的风险及由此造成的损失承担任何责任。
 * 详细情况请见《ChunMap许可协议》。

 * 想了解更多有关ChunMap的信息，请访问http://code.google.com/p/chunmap/
 */
package chunmap.model.relate.relateop;

import chunmap.model.geom.Geometry;
import chunmap.model.geom.GeometryCollection;
import chunmap.model.relate.ComputeIm;
import chunmap.model.relate.ComputeImFactory;
import chunmap.model.relate.IntersectionMatrix;

/**
 * 7RelationType
 * 
 * @author chunquedong
 * 
 */
public class Multi2Multi extends ComputeIm {

	public Multi2Multi(GeometryCollection m1, GeometryCollection m2) {
		g1 = m1;
		g2 = m2;
	}

	@Override
	protected void computeIM() {
		GeometryCollection c1 = (GeometryCollection) g1;
		GeometryCollection c2 = (GeometryCollection) g2;
		for (Geometry ge1 : c1) {
			for (Geometry ge2 : c2) {
				IntersectionMatrix tim = ComputeImFactory.getInstance()
						.getImComputer(ge1, ge2).getIM();
				im.unite(tim);
			}
		}
	}

	@Override
	protected int inner2innerDim(Geometry g1, Geometry g2) {
		return 0;
	}

	@Override
	protected boolean within(Geometry g1, Geometry g2) {
		return false;
	}

}
